<!---check permissions--->
<cfset haspermission = 1>
<cfif cgi.SCRIPT_NAME IS '/admin/index.cfm' AND request.admin_startup IS 0>
	<cfset haspermission = 1>
<cfelse>
	<cfif NOT cgi.SCRIPT_NAME IS '#request.absoluteadminpath#docs/permissiondenied.cfm' AND NOT c IS 'login' AND NOT c IS 'signout' >
        <cfif len(trim(c)) GT 0>
            <cfinvoke component="cfcs.admin.admin" 
            method="checkpermissions" 
            userlevel="#request.userlevel#"
            userid="#request.id#" 
            c="#c#" 
            a="#a#" 
            returnvariable="haspermission" />
        <cfelse>
            <cfset thefile = cgi.SCRIPT_NAME>
            <cfinvoke component="cfcs.admin.admin" 
            method="checkpermissions" 
            userlevel="#request.userlevel#"
            userid="#request.id#" 
            scriptname="#thefile#" 
            returnvariable="haspermission" />
        </cfif>
	</cfif>        
</cfif>

<cfif haspermission IS 0>
	<cfif fileexists('#request.adminpath#docs/permissiondenied.cfm')>
    <cfoutput>
		<script language="javascript">
			window.location.href = '#request.absoluteadminpath#docs/permissiondenied.cfm';
		</script>
	</cfoutput>
	<cfelse>
		<div style="color: #990000; font-weight: bold; text-align: center;">You not have access to perform that action.</div>
		<cfabort>
	</cfif>
</cfif>